package cn.ztuo.bitrade.util;

import cn.ztuo.bitrade.constant.SysConstant;
import cn.ztuo.bitrade.entity.SysSite;
import cn.ztuo.bitrade.service.SysSiteService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

import static cn.ztuo.bitrade.util.BigDecimalUtils.*;

@Slf4j
@Component
public class SysSiteUtils {

    @Autowired
    private SysSiteService siteServiceDouble;
    private static SysSiteService siteService;

    @PostConstruct
    public void init() {
        siteService = siteServiceDouble;
    }
    public static SysSiteService getSysSiteService() {
        return siteService;
    }
    public static SysSite getSite(){
        return siteService.findAll().get(0);
    }
    public static String getPhoneCorePrefix(){
        return siteService.findAll().get(0).getPhoneCorePrefix();
    }
    public static String getMailCorePrefix(){
        return siteService.findAll().get(0).getMailCorePrefix();
    }

}
